package com.sx.gongzhong.pest;

import android.content.Context;

import com.sx.gongzhong.model.ConvenniceAppealBean;
import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.AppealManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.model.BasePageListBean;
import com.sx.gongzhong.view.ConvenniceAppealView;

import java.util.Map;

/**便民诉求列表
 * Created by admin on 2018/1/3.
 */

public class ConvenniceAppealListPest {
    private ConvenniceAppealView convenniceAppealView;

    public ConvenniceAppealListPest(ConvenniceAppealView convenniceAppealView) {
        this.convenniceAppealView = convenniceAppealView;
    }

    public void getConvenniceAppealData(Context context, int page, int rows) {
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("sourcesState",0);
        map.put("page",page);
        map.put("rows",rows);
        new AppealManager().getConvenniceAppealData(map, new BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<ConvenniceAppealBean>>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<BasePageListBean<ConvenniceAppealBean>> response) {
                convenniceAppealView.getSuccess(response.data.rows,response.data.total);
            }
            @Override
            public void onFailures(String message) {
                convenniceAppealView.showError(message);
            }
        });
    }

    public void getMyConvenniceAppealData(Context context, int page, int rows) {
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("page",page);
        map.put("rows",rows);
        new AppealManager().getMyConvenniceAppealData(map, new BaseCallBack<ReplyUserBean.BaseResult<BasePageListBean<ConvenniceAppealBean>>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<BasePageListBean<ConvenniceAppealBean>> response) {
                convenniceAppealView.getSuccess(response.data.rows,response.data.total);
            }
            @Override
            public void onFailures(String message) {
                convenniceAppealView.showError(message);
            }
        });
    }
}
